<template>
  <div>
    <a-modal
      :title="title"
      wrapClassName="modal"
      :bodyStyle="{padding:'0 20px'}"
      width="90%"
      v-model="visible"
      :confirmLoading="confirmLoading"
      @ok="handleSubmit"
    >
      <rollin-case
        ref="rollinCase"
        :data="rollinCaseData"
        :key="rollinCaseData.outRecordId"
        :showSubmit="false" />
      <template slot="footer">
        <a-button key="back" @click="cancel">
          返回
        </a-button>
        <a-button v-if="okText!==''" key="submit" type="primary" :loading="confirmLoading" @click="handleSubmit">
          {{ okText }}
        </a-button>
      </template>
    </a-modal>
  </div>
</template>
<script>
import RollinCase from './RollinCase'
// import { refInUpdate, refInSave } from '@/api/referral'
export default {
  name: 'RollinCaseModal',
  props: {
  },
  components: {
    RollinCase
  },
  data () {
    return {
      description: '',
      visible: false,
      confirmLoading: false,
      rollinCaseData: {},
      disabledList: [],
      pageStatus: 'details',
      title: '电子病历',
      okText: ''
    }
  },
  beforeCreate () {
  },
  created () {
  },
  methods: {
    view (record, title) {
      var poptitle = title || ''
      this.init(record, poptitle, 'details')
      this.okText = ''
    },
    init (record, title, status) {
      this.pageStatus = status
      if (title) {
        this.title = title
      }
      this.rollinCaseData = record
      this.visible = true
    },
    cancel () {
      this.visible = false
    },
    modalSubmit () {
      this.visible = false
      this.$emit('ok')
    },
    handleSubmit (e) {
      e.preventDefault()
    }
  },
  watch: {
    /*
      'selectedRows': function (selectedRows) {
        this.needTotalList = this.needTotalList.map(item => {
          return {
            ...item,
            total: selectedRows.reduce( (sum, val) => {
              return sum + val[item.dataIndex]
            }, 0)
          }
        })
      }
      */
  }
}
</script>
<style>
.modal .ant-modal {
  top: 64px !important;
}
</style>
